//
//  RollingView.m
//  基本框架
//
//  Created by runone02 on 2018/8/20.
//  Copyright © 2018年 liqiyun. All rights reserved.
//

#import "RollingView.h"
#import "roliingCell.h"
#import "SortDragViewController.h"
#import "seqencingViewController.h"
#import "LockViewController.h"//手势解锁
#import "GravityViewController.h" //重力图片
#import "CacheViewController.h"
#import "TReaderViewController.h"
#import "ZZGestureLockViewController.h"
#import "ZMMessageViewController.h"
#import "NormalListController.h"
#import "SDMoreCicleViewController.h"
#import "MovieAddViewController.h"
#import "WKFRadarViewController.h"
#import "VideoViewController.h"
#import "KeyboardViewController.h"
#import "MDHViewController.h"
#import "UpdataViewController.h"
#import "PushListViewController.h"
#import "DropDownViewController.h"
#import "PasswordViewController.h"
#import "LrdSuperMenuViewController.h"
#import "CaiDanTableViewController.h"
#import "WuPinViewController.h"
#import "ClityListDatePickViewController.h"
#import "GouWuCheViewController.h"
#import "xuandizhiViewController.h"
#import "DongHuaViewController.h"
#import "WTShopcatViewController.h"
#import "JHMainViewController.h"
#import "AddShoppingCartViewController.h"
#import "TestViewController.h"
#import "XingZuoViewController.h"


@interface RollingView()<UICollectionViewDelegate,UICollectionViewDataSource>
/** */
@property (nonatomic, strong) UICollectionView *collectionView;
/** */
@property (nonatomic, strong) NSArray *cellArray;
@end
@implementation RollingView
static NSString *const collectionCellId = @"roliingCell";

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self setupUI];
        self.cellArray = @[@"选择置顶",@"通讯录",@"手势解锁",@"重力图片",@"数据缓存",@"翻页电子书",@"滑动电子书",@"连线解锁",@"选择",@"导航栏类型",@"触摸动画效果",@"滑动打分",@"雷达扫描",@"视频播放",@"自定义车牌输入键盘",@"指纹验证",@"版本更新",@"下拉选择框",@"下拉框",@"密码输入框",@"美团式下拉选择",@"联动菜单",@"物品选择",@"城市选择",@"购物车",@"城市选择",@"ios动画",@"购物",@"卡片选择动画",@"添加商品",@"多样式选择框",@"选择星座"];
    }
    return self;
}

- (void)setupUI {
    UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc]init];
    layout.minimumLineSpacing = 10 ;
    layout.minimumInteritemSpacing = 10 ;
    self.collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, SCALE_HIGHT(400), SCREEN_WIDTH, SCREEN_HEIGHT - SCALE_HIGHT(400)) collectionViewLayout:layout];
    
    self.collectionView.delegate = self;
    self.collectionView.dataSource = self;
    self.collectionView.backgroundColor = [UIColor whiteColor];
    self.collectionView.bounces = YES;
    [self.collectionView registerClass:[roliingCell class] forCellWithReuseIdentifier:collectionCellId];
    [self addSubview:_collectionView];
    [self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self);
        make.left.right.mas_equalTo(self);
        make.bottom.mas_equalTo(self).with.offset(-(10+49));
    }];
}

//- (void)initData{
//    for (NSInteger i = 0; i < 100; i++) {
//        NSString *str = [NSString stringWithFormat:@" %li",(long)i];
//        [self.cellArray addObject:str];
//    }
//}

//- (NSMutableArray *)cellArray{
//    if (!_cellArray) {
//        _cellArray = [NSMutableArray array];
//    }
//    return _cellArray;
//}

- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
    return 1;
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    return self.cellArray.count;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    roliingCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:collectionCellId forIndexPath:indexPath];
    
    cell.NameLabel.text = self.cellArray[indexPath.row];
    return cell;
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    NSLog(@"点击了第%ld个",(long)indexPath.row);
    if (indexPath.row == 0 ) {
        SortDragViewController * sort = [[SortDragViewController alloc]init];
        [self.viewController.navigationController pushViewController:sort animated:YES];
    }
    if (indexPath.row == 1) {
        seqencingViewController *seq = [[seqencingViewController alloc]init];
        [self.viewController.navigationController pushViewController:seq animated:YES];
    }
    if (indexPath.row == 2) {
        LockViewController *lock = [[LockViewController alloc]init];
        [self.viewController.navigationController pushViewController:lock animated:YES];
    }
    if (indexPath.row == 3) {
        GravityViewController *gra = [[GravityViewController alloc]init];
        [self.viewController.navigationController pushViewController:gra animated:YES];
    }
    if (indexPath.row == 4) {
        CacheViewController * cache = [[CacheViewController alloc]init];
        [self.viewController.navigationController pushViewController:cache animated:YES];
    }
    if (indexPath.row == 5) {
        TReaderViewController *vc = [[TReaderViewController alloc]init];
        vc.style = TReaderTransitionStylePageCur;
        [self.viewController.navigationController pushViewController:vc animated:YES];
    }
    if (indexPath.row == 6) {
        TReaderViewController *vc = [[TReaderViewController alloc]init];
        vc.style = TReaderTransitionStyleScroll;
        [self.viewController.navigationController pushViewController:vc animated:YES];
    }
    if (indexPath.row == 7) {
        ZZGestureLockViewController * ges = [[ZZGestureLockViewController alloc]init];
        [self.viewController.navigationController pushViewController:ges animated:YES];
    }
    if (indexPath.row == 8) {
        ZMMessageViewController *zm = [[ZMMessageViewController alloc]init];
        [self.viewController.navigationController  pushViewController:zm animated:YES];
    }
    if (indexPath.row == 9) {
        NormalListController *sec = [[NormalListController alloc]init];
        [self.viewController.navigationController pushViewController:sec animated:YES];
    }
    if (indexPath.row == 10) {
        SDMoreCicleViewController *sd = [[SDMoreCicleViewController alloc]init];
        [self.viewController.navigationController pushViewController:sd animated:YES];
    }
    if (indexPath.row == 11) {
        MovieAddViewController *moadd = [[MovieAddViewController alloc]init];
        [self.viewController.navigationController pushViewController:moadd animated:YES];
    }
    if (indexPath.row == 12) {
        WKFRadarViewController *wkf = [[WKFRadarViewController alloc]init];
        [self.viewController.navigationController pushViewController:wkf animated:YES];
    }
    if (indexPath.row == 13) {
        VideoViewController *video = [[VideoViewController alloc]init];
        [self.viewController.navigationController pushViewController:video animated:YES];
    }
    if (indexPath.row == 14) {
        KeyboardViewController *keyboard = [[KeyboardViewController alloc]init];
        [self.viewController.navigationController pushViewController:keyboard animated:YES];
    }
    if (indexPath.row == 15) {
        MDHViewController *hdh = [[MDHViewController alloc]init];
        [self.viewController.navigationController pushViewController:hdh animated:YES];
    }
    if (indexPath.row == 16) {
        UpdataViewController *updata = [[UpdataViewController  alloc]init];
        [self.viewController.navigationController pushViewController:updata animated:YES];
    }
    if (indexPath.row == 17) {
        PushListViewController *push = [[PushListViewController alloc]init];
        [self.viewController.navigationController pushViewController:push animated:YES];
    }
    if (indexPath.row == 18) {
        DropDownViewController *drop = [[DropDownViewController alloc]init];
        [self.viewController.navigationController pushViewController:drop animated:YES];
    }
    if (indexPath.row == 19) {
        PasswordViewController *pass = [[PasswordViewController alloc]init];
        [self.viewController.navigationController pushViewController:pass animated:YES];
    }
    if (indexPath.row == 20) {
        
        LrdSuperMenuViewController *lrd = [[LrdSuperMenuViewController alloc]init];
        [self.viewController.navigationController pushViewController:lrd animated:YES];
    }
    if (indexPath.row == 21) {
        CaiDanTableViewController *cai = [[CaiDanTableViewController alloc]init];
        [self.viewController.navigationController pushViewController:cai animated:YES];
    }
    if (indexPath.row == 22) {
        WuPinViewController *wu = [[WuPinViewController alloc]init];
        [self.viewController.navigationController pushViewController:wu animated:YES];
    }
    if (indexPath.row == 23) {
        ClityListDatePickViewController *clity = [[ClityListDatePickViewController alloc]init];
        [self.viewController.navigationController pushViewController:clity animated:YES];
    }
    if (indexPath.row == 24) {
        GouWuCheViewController *gouwu = [[GouWuCheViewController alloc]init];
        [self.viewController.navigationController pushViewController:gouwu animated:YES];
    }
    if (indexPath.row == 25) {
        xuandizhiViewController *city = [[xuandizhiViewController alloc]init];
        [self.viewController.navigationController pushViewController:city animated:YES];
    }
    if (indexPath.row == 26) {
        DongHuaViewController *donghua = [[DongHuaViewController alloc]init];
        [self.viewController.navigationController pushViewController:donghua  animated:YES];
    }
    if (indexPath.row == 27) {
        WTShopcatViewController *wt = [[WTShopcatViewController alloc]init];
        [self.viewController.navigationController pushViewController:wt animated:YES];
    }
    if (indexPath.row == 28) {
        JHMainViewController *jh = [[JHMainViewController alloc]init];
        [self.viewController.navigationController pushViewController:jh animated:YES];
    }
    if (indexPath.row == 29) {
        AddShoppingCartViewController *add = [[AddShoppingCartViewController alloc]init];
        [self.viewController.navigationController pushViewController:add animated:YES];
    }
    if (indexPath.row == 30) {
        TestViewController *test = [[TestViewController alloc]init];
        [self.viewController.navigationController pushViewController:test animated:YES];
    }
    if (indexPath.row == 31) {
        XingZuoViewController *xi = [[XingZuoViewController alloc]init];
        [self.viewController.navigationController pushViewController:xi animated:YES];
    }
    
}


@end
